package claim.geoobj;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import com.vividsolutions.jts.geom.Geometry;

/** A class for the management of partial boundaries of a topographical object and respective class-specific buffer sizes.
 * @author <a href="mailto:christoph.kinkeldey@hcu-hamburg.de">Christoph Kinkeldey</a>
 *
 */
public class Boundary {

	String id;
	Map<String, Geometry> partialBoundaries;
	Map<String, Double> sizes;
	private boolean outer;


	public Boundary(String id) {
		this.id = id;
		this.partialBoundaries = new HashMap<String, Geometry>();
		this.sizes = new HashMap<String, Double>();
	}
	
	public Geometry getBoundary(String neighId) {
		return partialBoundaries.get(neighId);
	}

	public void putBoundary(String neighId, Geometry geometry) {
		partialBoundaries.put(neighId, geometry);
	}
	
	public Set<String> getNeighbourIDs() {
		return partialBoundaries.keySet();
	}

	public double getBufferSize(String neighId) {
		if (sizes.containsKey(neighId)) {
			return sizes.get(neighId);
		} else {
			return Buffer.DEFAULT_BUFFER_SIZE;
		}
	}
	
	public void putBufferSize(String neighId, double size) {
		sizes.put(neighId, size);
	}
	
	public int size() {
		return partialBoundaries.size();
	}

	public String getObjId() {
		return id;
	}

	public boolean isOuter() {
		return outer;
	}
	
	public void setOuter(boolean outer) {
		this.outer = outer;
	}

}